package cn.etynit.mms.fallback;

import cn.etynit.dto.AccountLoginDto;
import cn.etynit.exception.GlobalExceptionCodeEnum;
import cn.etynit.mms.feign.UserService;
import cn.etynit.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserServiceFallbackFactory implements FallbackFactory<UserService> {
    @Override
    public UserService create(Throwable throwable) {
        return new UserService() {
            @Override
            public JsonResult get(Long id) {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }

            @Override
            public JsonResult accountLogin(AccountLoginDto accountLoginDto) {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }
        };
    }
}
